/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.uch.biblioteca.hibernateSpringDao;

import java.util.List;
import net.uch.biblioteca.mapping.BibCatalogo;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 *
 * @author Vasquez
 */
public class HSBibCatalogoDAOImpl extends HibernateDaoSupport implements HSBibCatalogoDAO {


    @Override
    public void eliminarCatalogoObj ( BibCatalogo catalogo ) throws Exception {

        this.getSession().delete( catalogo );
    }

    @Override
    public void guardarCatalogo ( BibCatalogo catalogo ) throws Exception {
        this.getHibernateTemplate().save( catalogo );
    }

    @Override
    public List<BibCatalogo> listarCatalogosPorColeccion ( String ColeccionTipo ) {
        List<BibCatalogo> lstCatalogos;
        Criteria criteria;

        criteria = this.getSession().createCriteria( BibCatalogo.class ).add( Restrictions.eq( "catCol", ColeccionTipo ) );
        lstCatalogos = criteria.list();
        return lstCatalogos;
    }
}
